package com.platform.hjt.from.controller;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.hjt.base.controller.BaseController;
import com.platform.hjt.base.controller.ReturnBody;
import com.platform.hjt.from.model.FromDefaultData;
import com.platform.hjt.from.service.FromDefaultDataService;
import com.platform.hjt.from.service.FromQjOrderService;

@Controller
@RequestMapping(value="/fromDefaultData")
public class FromDefaultDataController extends BaseController{

	@Resource
	private FromDefaultDataService fromDefaultDataService;
	@Resource
	private FromQjOrderService fromQjOrderService;
	
	@RequestMapping(value="/fromDefaultData_edit.do")
	@ResponseBody
	public ReturnBody fromDefaultDataEditDo(@Valid @ModelAttribute("fromDefaultData") FromDefaultData fromDefaultData, BindingResult result){
		if(result.hasErrors()){
			return new ReturnBody(false, result.getAllErrors().get(0).getDefaultMessage());
		}
		return fromDefaultDataService.saveFromDefaultData(fromDefaultData);
	}
	
	@RequestMapping(value="/jieshu.do")
	@ResponseBody
	public ReturnBody jieshu(String processId, String orderId, String taskId){
		return fromQjOrderService.handleJieshu(processId, orderId, taskId);
	}
	
}
